package lab02.test36;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {

        List<Student> students = new ArrayList<Student>();
        Scanner sc;
        Student student = null;

        System.out.println("请输入本科生的成绩：");
        for (int i = 0; i < 5; i++) {
            sc = new Scanner(System.in);


            System.out.print("请输入姓名：");
            student.name = sc.nextLine();

            System.out.print("请输入类别：");
            student.category = sc.nextLine();

            System.out.print("请输入分数用逗号隔开：");
            String[] stringScore = sc.nextLine().split(",");
            student.score[0] = Double.valueOf(stringScore[0]).doubleValue();
            student.score[1] = Double.valueOf(stringScore[1]).doubleValue();
            student.score[2] = Double.valueOf(stringScore[2]).doubleValue();

            students.add(student);
        }

        System.out.println("姓名\t类型\t成绩");
        for (Student stu : students) {
            System.out.print(stu.getName() + "\t"
                    + stu.getCategory() );
            if (stu.getCategory().equals("本科生")){
                System.out.println("本科生成绩");
            }else {
                System.out.println("研究生成绩");
            }
        }


    }
}
